Skip to content

[pull] main from MetaMask:main#400

Merged
pull[bot] merged 4 commits into
Reality2byte:mainfrom
MetaMask:main
Dec 11, 2025
Merged

[pull] main from MetaMask:main#400
pull[bot] merged 4 commits into
Reality2byte:mainfrom
MetaMask:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Dec 11, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

Matt561 and others added 4 commits December 10, 2025 23:43
… to be incorrectly geo-blocked (#23895)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**
Fix race condition causing users to be geo-blocked incorrectly.

The Bug: `refreshEligibility()` is called with fallback regions but
isn't awaited — so the constructor continues, updates to remote config,
and starts new eligibility checks. The fallback check finishes last and
overwrites the correct remote result with false.

Workaround: a version counter ensures stale checks (started before the
config changed) are discarded when they complete.

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: fix perps refreshEligibility race condition causing
users to be geo-blocked

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Guards async eligibility updates with a versioned blocked-region list
to avoid stale fallback results overwriting remote-config checks.
> 
> - **PerpsController
(`app/components/UI/Perps/controllers/PerpsController.ts`)**
> - Add `blockedRegionListVersion` to track changes to
`blockedRegionList`.
> - Increment version when setting blocked regions in
`setBlockedRegionList` and in `refreshEligibilityOnFeatureFlagChange`.
>   - Update `refreshEligibility()` to:
> - Capture version at start and skip state updates if version changed
while awaiting.
>     - Only set default eligible on error if version is unchanged.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
1fa308b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Nicholas Gambino <nicholas.gambino@consensys.net>
#23904)

## **Description**

remove background from more button in multichain account selector

## **Changelog**

CHANGELOG entry:null

## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/MDP-277

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]
```

## **Screenshots/Recordings**

| before | after |
| -------- | ------- |
|
![before](https://github.com/user-attachments/assets/ac3d8983-b0e4-4310-90c9-7ac210a563b1)
|
![after](https://github.com/user-attachments/assets/55113c0c-92c8-4432-9405-3f4d3161e832)
|

### **Before**

`~`

### **After**

`~`

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Removes background, border radius, and fixed dimensions from the
multichain account cell "more" menu button, updating snapshots
accordingly.
> 
> - **UI (Multichain Accounts)**
> - `AccountCell.styles.ts`: Remove `menuButton` `backgroundColor`,
`borderRadius`, `height`, and `width` to make the "more" button
icon-only.
> - **Tests**
> - Update snapshots in `MultichainAccountsConnectedList.test.tsx.snap`
to reflect the menu button style change.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5b2e2cc. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description**

Updating most instances of selected item background color to
`colors.background.muted`

## **Changelog**

CHANGELOG entry:null

## **Related issues**

Fixes:
Region Picker: https://consensyssoftware.atlassian.net/browse/MDP-280
Network Picker: https://consensyssoftware.atlassian.net/browse/MDP-239
Sort: https://consensyssoftware.atlassian.net/browse/MDP-243

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]
```

## **Screenshots/Recordings**

### Network Manager

| before | after |
| -------- | ------- |
|
![before](https://github.com/user-attachments/assets/f1b42b64-fd93-4637-8cc7-221a4c06f701)
|
![after](https://github.com/user-attachments/assets/17da788d-b98b-490a-b6eb-b83daa7a9f77)
|

### RPC Selection

| before | after |
| -------- | ------- |
|
![before](https://github.com/user-attachments/assets/a2f61ed3-7824-4d50-947e-56009092105f)
|
![after](https://github.com/user-attachments/assets/11ac9bf1-944c-4515-ba0e-300b8c8267a2)
|

### Sort

| before | after |
| -------- | ------- |
|
![before](https://github.com/user-attachments/assets/526f51e0-66bb-4a06-a624-d7a96d1defbe)
|
![after](https://github.com/user-attachments/assets/33ac49a5-5556-4723-bcad-b8e08f79acd5)
|

### Payment Selector

| before | after |
| -------- | ------- |
|
![before](https://github.com/user-attachments/assets/d82a614b-9e2e-4360-915e-afd23267120a)
|
![after](https://github.com/user-attachments/assets/596288fd-2aaa-43ee-aba6-416dcd6396a0)
|

### Region Picker

| before | after |
| -------- | ------- |
|
![before](https://github.com/user-attachments/assets/18557999-e62a-4b46-b329-9a187cd6020a)
|
![after](https://github.com/user-attachments/assets/c669f5d9-1f58-473e-a736-13c2bbbcf986)
|

### Select Network

| before | after |
| -------- | ------- |
|
![before](https://github.com/user-attachments/assets/e6b0ca02-ce25-4ed1-b9e6-653c3b991ee1)
|
![after](https://github.com/user-attachments/assets/9d9f47a6-2b85-4fb1-89e1-d2617c453f26)
|

### **Before**

`~`

### **After**

`~`

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Updates selected item visuals across lists/selectors to use
`colors.background.muted` and drops the side underlay bar indicator,
with snapshots adjusted.
> 
> - **Styling/UX**:
> - Use `colors.background.muted` for selected states in
`ListItemMultiSelect`, `ListItemSelect`, `ListItemMultiSelectButton`,
and downstream UI (account/network/region/token selectors, permissions
screens).
> - Remove underlay side bar visuals (`underlayBar`, width strip) and
related props/tests; retain simple full-row underlay where applicable.
> - **Components**:
> - `components-temp/ListItemMultiSelectButton`: selected container
background updated; removed underlay view rendering; tests simplified
(icon/press only).
> - `components/List/ListItemSelect`: underlay color changed; removed
`underlayBar`; kept minimal `underlay` view.
>   - `components/List/ListItemMultiSelect`: underlay color changed.
>   - Remove unused constant `SELECTABLE_ITEM_UNDERLAY_ID`.
> - **Tests/Snapshots**:
> - Snapshot updates to reflect color change (`#4459ff1a` → `#3c4d9d0f`)
and removal of side bar indicator across numerous selector/modal views.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9dbd116. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR refactors wallet deletion logic by consolidating the
`useDeleteWallet` hook into the `Authentication` service class. The
refactoring improves code organization, ensures consistent wallet
deletion behavior, and simplifies the codebase by removing redundant
hook logic.

**Reason for the change:**
1. The `useDeleteWallet` hook duplicated logic that should be
centralized in the `Authentication` service
2. `resetWalletState` and `deleteUser` were always used together, but
there was no enforcement of this pattern
3. Having wallet deletion logic in a hook created unnecessary coupling
between React components and core authentication logic
4. The hook pattern was not appropriate for core service operations that
don't depend on React lifecycle

**Improvement/Solution:**
1. **Moved Logic to Authentication Service**: Consolidated
`resetWalletState` and `deleteUser` methods into
`app/core/Authentication/Authentication.ts` as protected methods
2. **Created Public API**: Added `deleteWallet()` as the main public
method that ensures `resetWalletState()` is always called before
`deleteUser()`
3. **Protected Methods**: Made `resetWalletState` and `deleteUser`
protected to prevent direct external access and enforce the correct
usage pattern through `deleteWallet()`
4. **Updated All Call Sites**: Refactored `usePromptSeedlessRelogin` and
`DeleteWalletModal` to use the new `Authentication.deleteWallet()`
method
5. **Comprehensive Test Coverage**: Added tests for the new
`deleteWallet()` method and maintained test coverage for the protected
methods

**Key Technical Improvements:**
- **Removed Hook**: Deleted
`app/components/hooks/DeleteWallet/useDeleteWallet.ts` and related test
files
- **Centralized Logic**: All wallet deletion logic is now in the
`Authentication` service, following the single responsibility principle
- **Enforced Usage Pattern**: The protected methods ensure that wallet
reset and user deletion always happen in the correct sequence
- **Better Encapsulation**: Protected methods prevent accidental misuse
and make the API surface clearer
- **Consistent Behavior**: All wallet deletion flows now use the same
underlying implementation

## **Changelog**

CHANGELOG entry: Refactored wallet deletion logic by consolidating
useDeleteWallet hook into Authentication service

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
Feature: Wallet Deletion

  Scenario: Delete wallet from seedless relogin prompt
    Given the user encounters a seedless controller error
    And the error prompt is displayed
    When the user taps the primary button to delete wallet
    Then the wallet state should be reset
    And user data should be deleted
    And the user should be navigated to onboarding
    And no errors should occur during the deletion process

  Scenario: Delete wallet from settings
    Given the user is viewing the Security Settings screen
    And the user navigates to the Delete Wallet modal
    When the user confirms wallet deletion
    Then the wallet state should be reset
    And user data should be deleted
    And cookies should be cleared
    And the user should be navigated to onboarding
    And analytics should track the deletion event

  Scenario: Wallet deletion error handling
    Given the user attempts to delete the wallet
    When an error occurs during wallet reset
    Then the error should be logged
    And the loading state should be reset
    And the user should see appropriate error feedback
    And the app should remain in a stable state
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- 
Before: Wallet deletion logic was split between a hook and the
Authentication service
- useDeleteWallet hook managed resetWalletState and deleteUser
separately
- Components had to call both methods in sequence manually
- No enforcement that both methods were always called together
-->

### **After**


https://github.com/user-attachments/assets/7dcb9cc3-cb52-4c50-8f1c-009fa402d1de



<!-- 
After: Wallet deletion is centralized in Authentication service
- Single deleteWallet() method ensures correct sequence
- Protected methods prevent misuse
- Cleaner component code with single method call
-->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Centralizes wallet deletion into `Authentication.deleteWallet()` and
refactors consumers/tests to use it, removing the old `useDeleteWallet`
hook.
> 
> - **Core (Authentication)**:
> - Add `Authentication.deleteWallet()` as the public API; implements
sequential `resetWalletState` → `deleteUser`.
> - `resetWalletState` (protected): clears vault backups,
disables/re-enables `EngineClass.disableAutomaticVaultBackup`, creates
temp wallet, clears seedless state, resets rewards via
`Engine.controllerMessenger`, clears provider token, locks app (no
navigation).
> - `deleteUser` (protected): dispatches `setExistingUser(false)` and
triggers `MetaMetrics.createDataDeletionTask`.
> - Also removes `OPTIN_META_METRICS_UI_SEEN` and dispatches
`setCompletedOnboarding(false)`.
> - **UI**:
> - `DeleteWalletModal`: replace hook flow with
`Authentication.deleteWallet()`, keep sign-out, clear cookies, dispatch
`clearHistory`, track event, then navigate to onboarding.
> - `usePromptSeedlessRelogin`: invoke `Authentication.deleteWallet()`
and simplify flow; maintain loading/error state and `clearHistory` +
sign-out + navigation.
> - **Hooks**:
>   - Remove `app/components/hooks/DeleteWallet/*` (hook and tests).
> - **Tests**:
> - Add comprehensive tests for `deleteWallet`, `resetWalletState`, and
`deleteUser` in `Authentication.test.ts`.
> - Update component/hook tests to assert calls to
`Authentication.deleteWallet()` and revised action sequences; remove
assertions tied to deleted hook/storage calls.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b71e98d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@pull pull Bot locked and limited conversation to collaborators Dec 11, 2025
@pull pull Bot added the ⤵️ pull label Dec 11, 2025
@pull pull Bot merged commit 28d715f into Reality2byte:main Dec 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants